package com.yazi.mxz.common.entity.beans;

import com.myframework.smhj.hibernate.Entity;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * LocalSale entity. @author MyEclipse Persistence Tools
 */
@javax.persistence.Entity
@Table(name = "MXZ_LOCAL_SALE", schema = "MXZ")
public class LocalSale extends Entity implements java.io.Serializable {

	// Fields

	private Long saleId;
	private Member member;
	private Store store;
	private String serialCode;
	private Set<LocalSaleGoods> localSaleGoodses = new HashSet<LocalSaleGoods>(
			0);

	// Constructors

	/** default constructor */
	public LocalSale() {
	}

	/** minimal constructor */
	public LocalSale(Store store, String serialCode) {
		this.store = store;
		this.serialCode = serialCode;
	}

	/** full constructor */
	public LocalSale(Member member, Store store, String serialCode,
			Set<LocalSaleGoods> localSaleGoodses) {
		this.member = member;
		this.store = store;
		this.serialCode = serialCode;
		this.localSaleGoodses = localSaleGoodses;
	}

	// Property accessors
	@SequenceGenerator(name = "generator", sequenceName = "SEQ_LOCAL_SALE")
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "SALE_ID", unique = true, nullable = false, precision = 15, scale = 0)
	public Long getSaleId() {
		return this.saleId;
	}

	public void setSaleId(Long saleId) {
		this.saleId = saleId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MEMBER_ID")
	public Member getMember() {
		return this.member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "STORE_ID", nullable = false)
	public Store getStore() {
		return this.store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	@Column(name = "SERIAL_CODE", nullable = false, length = 50)
	public String getSerialCode() {
		return this.serialCode;
	}

	public void setSerialCode(String serialCode) {
		this.serialCode = serialCode;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "localSale")
	public Set<LocalSaleGoods> getLocalSaleGoodses() {
		return this.localSaleGoodses;
	}

	public void setLocalSaleGoodses(Set<LocalSaleGoods> localSaleGoodses) {
		this.localSaleGoodses = localSaleGoodses;
	}

}